package net.csdn.business.common.domain.issue.event;

import lombok.*;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.util.List;

/**
 * @author likun
 * @date 2022/11/30 14:29
 */
@Data
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@ToString(callSuper = true)
public class MilepostEventDto extends BaseEventDto {
    private List<Goal> goals;

    private Boolean delete;

    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    public static class Goal implements Serializable {
        /**
         * 里程碑ID
         */
        private String objectId;

        /**
         * 里程碑名称
         */
        private String goalName;
    }


    public static MilepostEventDto buildChangeEvent(String id, String actionUid, boolean delete, List<MilepostEventDto.Goal> goals) {
        return MilepostEventDto.builder()
                .id(id).actionUid(actionUid)
                .goals(goals).delete(delete)
                .build();
    }
}